package com.ccc.dingtalk.mapper;

import com.ccc.dingtalk.pojo.db.Bulletin;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @author superC
 * @version 2.0.0
 * @date 2023/8/13
 */

@Mapper
public interface BulletinMapper extends BaseMapper<Bulletin> {

    @Select(value = "select * from bulletin")
    List<Bulletin> findAll();

    @Insert("INSERT INTO bulletin(id, title, content, optdate, autotoday) VALUES(#{id}, #{title}, #{content}, #{optdate}, #{autotoday})")
    void insert(Bulletin entity);

    @Update("UPDATE bulletin SET title = #{title}, content = #{content}, optdate = #{optdate}, autotoday = #{autotoday} WHERE id = #{id}")
    void update(Bulletin entity);

    @Delete("DELETE FROM bulletin WHERE id = #{id}")
    void delete(Long id);
}
